
use WebSecurity;
	
--*************************************************************
--Created By: trooks
--Name: Drop All Foreign Keys
--Database: WebSecurity
--Created Date: 01/21/2013 09:55:58
--*************************************************************
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_UserProfile_dbo_Membership]') AND parent_object_id = OBJECT_ID(N'[dbo].[Membership]'))
ALTER TABLE [dbo].[Membership] DROP CONSTRAINT [fk_dbo_UserProfile_dbo_Membership]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_PasswordQuestion_dbo_Membership]') AND parent_object_id = OBJECT_ID(N'[dbo].[Membership]'))
ALTER TABLE [dbo].[Membership] DROP CONSTRAINT [fk_dbo_PasswordQuestion_dbo_Membership]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_UserProfile_dbo_OAuthMembership]') AND parent_object_id = OBJECT_ID(N'[dbo].[OAuthMembership]'))
ALTER TABLE [dbo].[OAuthMembership] DROP CONSTRAINT [fk_dbo_UserProfile_dbo_OAuthMembership]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_Application_dbo_ApplicationRoles]') AND parent_object_id = OBJECT_ID(N'[dbo].[ApplicationRoles]'))
ALTER TABLE [dbo].[ApplicationRoles] DROP CONSTRAINT [fk_dbo_Application_dbo_ApplicationRoles]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_UserProfile_dbo_UsersInRoles]') AND parent_object_id = OBJECT_ID(N'[dbo].[UsersInRoles]'))
ALTER TABLE [dbo].[UsersInRoles] DROP CONSTRAINT [fk_dbo_UserProfile_dbo_UsersInRoles]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_ApplicationRoles_dbo_UsersInRoles]') AND parent_object_id = OBJECT_ID(N'[dbo].[UsersInRoles]'))
ALTER TABLE [dbo].[UsersInRoles] DROP CONSTRAINT [fk_dbo_ApplicationRoles_dbo_UsersInRoles]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_UserProfile_dbo_UserProfileData]') AND parent_object_id = OBJECT_ID(N'[dbo].[UserProfileData]'))
ALTER TABLE [dbo].[UserProfileData] DROP CONSTRAINT [fk_dbo_UserProfile_dbo_UserProfileData]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_UserProfile_dbo_ApplicationUser]') AND parent_object_id = OBJECT_ID(N'[dbo].[ApplicationUser]'))
ALTER TABLE [dbo].[ApplicationUser] DROP CONSTRAINT [fk_dbo_UserProfile_dbo_ApplicationUser]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_Application_dbo_ApplicationUser]') AND parent_object_id = OBJECT_ID(N'[dbo].[ApplicationUser]'))
ALTER TABLE [dbo].[ApplicationUser] DROP CONSTRAINT [fk_dbo_Application_dbo_ApplicationUser]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_dbo_Application_dbo_ApplicationProfileData]') AND parent_object_id = OBJECT_ID(N'[dbo].[ApplicationProfileData]'))
ALTER TABLE [dbo].[ApplicationProfileData] DROP CONSTRAINT [fk_dbo_Application_dbo_ApplicationProfileData]
GO
